package mathive.client;

import mathive.client.menu.MenuPanel;
import mathive.client.panels.ChangePassPanel;
import mathive.client.panels.ContactPanel;
import mathive.client.panels.CreateTestPanel;
import mathive.client.panels.ForgotPassPanel;
import mathive.client.panels.GamesPanel;
import mathive.client.panels.HomePanel;
import mathive.client.panels.ManageTestsPanel;
import mathive.client.panels.RegisterPanel;
import mathive.client.panels.ResultsPanel;
import mathive.client.panels.TestsPanel;
import mathive.client.panels.UserListPanel;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.VerticalPanel;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class Mathive implements EntryPoint {
	
	private VerticalPanel mainPanel = new VerticalPanel();
	private HomePanel homePanel = new HomePanel();
	private GamesPanel gamesPanel = new GamesPanel();
	private TestsPanel testsPanel = new TestsPanel();
	private ContactPanel contactPanel = new ContactPanel();
	private ResultsPanel resultsPanel = new ResultsPanel();
	private RegisterPanel registerPanel = new RegisterPanel();
	private ForgotPassPanel forgotPassPanel = new ForgotPassPanel();
	private ChangePassPanel changePassPanel = new ChangePassPanel();
	private CreateTestPanel createTestPanel = new CreateTestPanel();
	private SudokuCreator createSudokuPanel = new SudokuCreator();
	private UserListPanel userListPanel = new UserListPanel();
	private ManageTestsPanel manageTestsPanel = new ManageTestsPanel();

	/**
	 * This is the entry point method.
	 */
	public void onModuleLoad() {
		final LoginSidebar loginBox = new LoginSidebar();
		loginBox.addStyleName("loginBox");
		RootPanel.get("loginBoxContainer").add(loginBox);
		
		UserHandler.initialize();
		UserHandler.singleton.setLoginbar(loginBox);
		
		mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
		mainPanel.setWidth("100%");
		
		PanelHandler.initialize(mainPanel, homePanel, gamesPanel, testsPanel,
				contactPanel, resultsPanel, registerPanel, forgotPassPanel,
				changePassPanel, createTestPanel, createSudokuPanel, userListPanel, manageTestsPanel);
		PanelHandler.showHome();
		RootPanel.get("maincontent").add(mainPanel);
		
		MenuPanel menu = new MenuPanel();
//		RootPanel.get("menucontent").add(menu);
		new WindowHandler();
	}
}
